/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BO;

import java.util.List;
import java.util.Set;
import org.openqa.selenium.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriver.Navigation;
import org.openqa.selenium.WebDriver.Options;
import org.openqa.selenium.WebDriver.TargetLocator;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

/**
 *
 * @author zhuhuah
 */
public class Login_BO {
    public void login(String userName, String passWord, String url)
    {
        WebDriver webDLogin = new FirefoxDriver();
        webDLogin.get(url);

        WebElement webELoginName, webEPassWord, webEOrganization, webESubmit, webEChannelID = null;

        webELoginName = webDLogin.findElement(By.name("LoginForm_Login"));
        webELoginName.sendKeys(userName);

        webEPassWord = webDLogin.findElement(By.name("LoginForm_Password"));
        webEPassWord.sendKeys(passWord);

        webEOrganization = webDLogin.findElement(By.name("LoginForm_RegistrationDomain"));
        webEOrganization.sendKeys("HP");

        webESubmit = webDLogin.findElement(By.name("submit"));
        webESubmit.click();
        
        Select sChannelID = new Select(webDLogin.findElement(By.name("ChannelID")));
        sChannelID.selectByValue("B3wQwSiE3h8AAAExqc1vnbv3");    
    }
}
